home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / VISUALBA / BOZOL2.ZIP / BOZOL.DOC < prev    next >
Text File  |  1994-02-08  |  28KB  |  619 lines

  1.  
  2.  
  3.         1. WHAT IS BOZOL?
  4.         2. BOZOL COMMANDS AND FUNCTIONS - STARTER SET
  5.         3. BOZOL PROGRAMMING RULES
  6.         4. HOW TO ADD COMMANDS AND FUNCTIONS
  7.         5. CALLING BOZOL FROM YOUR OWN PROGRAMS
  8.  
  9.         1. WHAT IS BOZOL?
  10.  
  11.         BozoL (The Bozo Language) is an extremely simple interpretive
  12.         language written in PowerBASIC.  It is designed to be easy to
  13.         use, easy to modify, and to run as fast as possible.
  14.  
  15.         Some of the rules in BozoL may seem a bit wierd, but there is a
  16.         reason for this.  After writing a BASIC interpreter (EBASIC.ZIP)
  17.         I discovered that the fundamental design of BASIC makes it
  18.         extremely difficult to parse and interpret with any sort of
  19.         reasonable speed.  BozoL is purposely designed to run as fast
  20.         as possible as an interpreted language.
  21.  
  22.         Why BozoL?
  23.  
  24.         Every now and then a situation may arise where you will want to
  25.         incorporate a command language into your programs.  BozoL can be
  26.         easily modified to do things relevant to your program's needs.
  27.         Suppose you have a database program and you want to allow your
  28.         users to program their own custom procedures without having to
  29.         go back to the original source code and add them in.
  30.  
  31.         BozoL is a language skeleton.  All of the dirty work has been
  32.         done already.  BozoL already contains expression parsing, program
  33.         flow control, basic logic, and other fundamental building blocks
  34.         of a programming language (print, input, variables, etc).
  35.  
  36.         BozoL is simple.  There are not a lot of rules, punctuation, or
  37.         wierd symbols in the language.  It is a real beginner's language.
  38.  
  39.         All you need to do now is add your own custom commands and key-
  40.         words to the language.  See section 4, "How to add commands and
  41.         functions" for the exact details on how to do this.
  42.  
  43.         Prototypes and Applications
  44.  
  45.         Suppose you have a library of routines that pop up boxes, print
  46.         menus, display pictures, etc.  You can take these routines and
  47.         make BozoL commands out of them.  For instance, if you have a
  48.         PowerBASIC subroutine that displays a message inside a red box
  49.         on the center of the screen, you can make a BozoL command which
  50.         calls this subroutine.  So now in BozoL you can say
  51.  
  52.                 REDBOX "press any key to continue!"
  53.  
  54.         and BozoL will call your subroutine.  Using this technique, you
  55.         can take an entire library, or many libraries, and make BozoL
  56.         commands out of all of those subroutines.
  57.  
  58.         I'll give you a more advanced example.  Suppose you have a Power-
  59.         BASIC library that features pull-down menus, dialog boxes, list
  60.         boxes, a text editor, and data entry screens.  If you took every
  61.         callable SUB and FUNCTION in this library and made BozoL commands
  62.         out of them, then you could use the BozoL language to write
  63.         really neat user-interface programs, prototypes, or even finished
  64.         products.  Instead of shipping an EXE, you can ship the BozoL
  65.         interpreter along with an interpreted BozoL program that can
  66.         be easily modified by your customers without ever having to
  67.         give them the source code or customizing the program yourself.
  68.  
  69.         Software upgrades could be faxed to your customers or even
  70.         dictated over the phone.
  71.  
  72.         Process Control
  73.  
  74.         You could use BozoL to control machinery.  You could add commands
  75.         like TURN EVERYTHING OFF or DISPLAY STATUS OF MIXER 1.  By inventing
  76.         commands and adding them to the language you could turn BozoL into
  77.         a high level language that does almost anything, for any purpose.
  78.         Users could enter direct statements or run programs that display
  79.         menus and perform certain tasks, and easily add to or modify the
  80.         system without a lot of complicated programming.  Consider these
  81.         possible additions to the language:
  82.  
  83.                 DISPLAY SCHEMATIC
  84.                 BLOCK PHONES
  85.                 ELECTRIC FENCES OFF
  86.                 DISENGAGE SECURITY IN DINOSAUR EMBRYO LAB
  87.  
  88.         With the fundamental building blocks of the language already in
  89.         place (like GOTO, GOSUB, IF, LOAD, RUN, SAVE, PRINT, INPUT, LOCATE,
  90.         COLOR, LET, etc) you can easily build a custom language that works
  91.         well, runs fast, can handle almost any programming task, and can
  92.         call subroutines written in BASIC, C, Assembler, or BozoL.  Since
  93.         most of the nitty gritty is compiled in (like what do do when the
  94.         command BLOCK PHONES is issued) it will almost always seem to
  95.         run just as fast as a compiled program.
  96.  
  97.         2. BOZOL COMMANDS AND FUNCTIONS - STARTER SET
  98.  
  99.         As I mentioned in part 1, all of the fundamental building blocks
  100.         of the language, its structure, variable handling and flow control
  101.         have already been built in.  All you need to do is add new key
  102.         words and the code that is executed when BozoL sees the key word.
  103.  
  104.         These are the key words that are built in to BozoL already:
  105.  
  106.  
  107.          ASC       ASCII     BE        CALC      CASE      CHR       CLS
  108.          COLOR     CR        EQUAL     EQUALS    EVAL      FALSE     GOSUB
  109.          GOTO      IF        IN        INKEY     INPUT     IS        LCASE
  110.          LEFT      LEN       LET       LIST      LOAD      LOCATE    LOWER
  111.          LTRIM     MID       NOT       PRINT     PROMPT    QUIT      RETURN
  112.          RIGHT     RTRIM     RUN       SAME      SAVE      SET       SUBSTR
  113.          TAB       TO        TRUE      UCASE     UNTIL     UPPER     WHAT
  114.          WHILE     WITH
  115.  
  116.         (... and added since this writing...)
  117.  
  118.         END
  119.  
  120.         See the file BOZOL.REF for a complete description of each command
  121.         and examples of how to use them in your programs.
  122.  
  123.         3. BOZOL PROGRAMMING RULES
  124.  
  125.         BozoL is funny for a couple of reasons.  First, the syntax is
  126.         probably unlike any language you have ever seen.  As I mentioned
  127.         earlier, this is to make it easier for the interpreter to
  128.         parse and execute its statements.  Easier means faster.
  129.  
  130.         BozoL also has keywords which don't do anything.  The reason for
  131.         these keywords is to make the awkward syntax a bit easier to
  132.         stomach.  Remember these keywords when adding your own commands
  133.         to BozoL.  They can come in handy.
  134.  
  135.         Keywords that don't do anything:
  136.  
  137.                 "TO", "IN", "WITH", "IS", "BE", "EQUAL", "OF", "THE"
  138.  
  139.         You will see me using these in program examples every once in a while.
  140.         For instance, to assign a value to a variable you could say
  141.  
  142.                 SET A TO 1
  143.  
  144.         Although the word "TO" is not really necessary.  You could also
  145.         say
  146.  
  147.                 SET A 1
  148.  
  149.         but that looks silly and its meaning would not be clear to someone
  150.         who does not know all about BozoL (like anyone does but me!).
  151.  
  152.         Which brings up another rule:  BozoL statements are parsed with
  153.         spaces, commas, or semicolons.  It does not matter which you use
  154.         and it does not matter how you mix them.  For instance, these
  155.         expressions are all the same:
  156.  
  157.                 SET A TO 1
  158.                 SET A,1
  159.                 SET;A;1
  160.                 SET   A   TO   1
  161.  
  162.         Also, multiple statements can be on the same line.  In fact, it
  163.         is necessary to put multiple statements on the same line in some
  164.         cases.  Multiple statements are separated by colons, just like
  165.         BASIC.
  166.  
  167.                 SET A TO 1: PRINT A: PRINT "GoodBye!":END
  168.  
  169.         Now here's another bit of silliness:  BozoL will also allow
  170.         you to place multiple statements on a line without using colons
  171.         to separate them, BUT if you do not use colons the statements will
  172.         be executed in REVERSE ORDER.
  173.  
  174.         For example, if you said
  175.  
  176.                 PRINT 1: PRINT 2: PRINT 3
  177.  
  178.         BozoL wou